#ifndef __SEQLIST_H__
#define __SEQLIST_H__

// 顺序表结构
typedef struct {
	void *arr; // 指向数据的起始地址
	int nmemb;
	int size;
	int capacity;
}seqlist_t;
// seqlist_t  就是结构体类型

typedef void (*pri_t)(const void *data);
typedef int (*cmp_t)(const void *data, const void *key);

// *mylist顺序表结构的起始地址
int seqlist_init(seqlist_t **mylist, int size, int capacity);

int seqlist_empty(const seqlist_t *mylist);

int seqlist_full(const seqlist_t *mylist);

int seqlist_insert(seqlist_t *mylist, const void *data);

int seqlist_insert_tail(seqlist_t *mylist, const void *data);

int seqlist_delete(seqlist_t *mylist, const void *key, cmp_t cmp);

// 与删除的区别 找到与key匹配的结点从顺序表中删除并得到数据
int seqlist_fetch(seqlist_t *mylist, const void *key, cmp_t cmp, void *data);

void seqlist_traval(const seqlist_t *mylist, pri_t pri);

void *seqlist_search(const seqlist_t *mylist, const void *key, cmp_t cmp);

void seqlist_destroy(seqlist_t **mylist);

void seqlist_bubble_sort(const seqlist_t *mylist, cmp_t cmp);

void seqlist_reverse(const seqlist_t *mylist);

#endif


